package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 饮料换购 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=1010;
       static int n;
       public static void main(String[] args) throws NumberFormatException, IOException {
		      n=Integer.parseInt(br.readLine());
		      int t=n;
		      int res=0;
		      while(n>2){
		    	  res+=n/3;
		    	  n=n/3+n%3;
		      }
		      System.out.print(t+res);
	}
}
